//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>

#include "ProcessBindingFASTAProfile.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int main (int argc, char** argv) {
  
  String* filenameBindingProfile = NULL;
  String* category               = NULL;
  String* filenameOut            = NULL;
  
  if (argc < 4) {
    
    cout << "Error in the input parameters! Must by like: " << endl;
    cout << "./DeleteInLigandFASTAProfileDuplication <In File - Ligand FASTA Profile>";
    cout <<                                        " <Category - CATH SOLID>";
    cout <<                                        " <Out File>";
    cout << endl;
    
    return 0;
    
  }
  else {
    
    filenameBindingProfile  = new String(argv[1]);
    category                = new String(argv[2]);
    filenameOut             = new String(argv[3]);
    
    cout << "------------------------------------------------------------------------------------------------------" << endl;
    cout << " In File - Ligand FASTA Profile : " << argv[1] << endl;
    cout << "          Category - CATH SOLID : " << argv[2] << endl;
    cout << "                       Out File : " << argv[3] << endl;
    cout << "------------------------------------------------------------------------------------------------------" << endl;
    
  }
  
  ProcessBindingFASTAProfile* processBindingFASTAProfile = new ProcessBindingFASTAProfile ();
  
  cout << "Preparing Files..." << endl;
  processBindingFASTAProfile->FilenameBindingProfile(filenameBindingProfile);
  processBindingFASTAProfile->FilenameOut(filenameOut);
  
  cout << "Loading the data..." << endl;
  if (!processBindingFASTAProfile->LoadBindingProfile())
    cout << "Error Loading data!" << endl;

  cout << "Hidden duplication in the Binding FASTA Profile..." << endl;
  switch (category->Out()[0]) {
    
    case 'C' : cout << "By Classes..."                    << endl; processBindingFASTAProfile->HideEqualClassN();                 break;
    case 'A' : cout << "By Architecture..."               << endl; processBindingFASTAProfile->HideEqualArchitectureN();          break;
    case 'T' : cout << "By Topology..."                   << endl; processBindingFASTAProfile->HideEqualTopologyN();              break;
    case 'H' : cout << "By Homologous Family..."          << endl; processBindingFASTAProfile->HideEqualHomologousSuperFamilyN(); break;
    case 'S' : cout << "By Similar Family (35%)..."       << endl; processBindingFASTAProfile->HideEqualSimilar35PercentN();      break;
    case 'O' : cout << "By Homologous Sequences (60%)..." << endl; processBindingFASTAProfile->HideEqualHomologous60PercentN();   break;
    case 'L' : cout << "By Like Sequences (90%)..."       << endl; processBindingFASTAProfile->HideEqualLike90PercentN();         break;
    case 'I' : cout << "By Equal Sequences (100%)..."     << endl; processBindingFASTAProfile->HideEqualIdentical100PercentN();   break;
    case 'D' : cout << "By Domain Counter..."             << endl; processBindingFASTAProfile->HideEqualDomainN();                break;
    default  : break;
  
  }
  
  cout << "Finished..." << endl << "Good Bye" << endl;
  
  if (processBindingFASTAProfile) delete processBindingFASTAProfile;
  
  if (filenameBindingProfile)     delete filenameBindingProfile;
  if (category)                   delete category;
  if (filenameOut)                delete filenameOut;

  return EXIT_SUCCESS;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//

